package com.momo.encoderHandler2;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @author Kagome
 * @title: MyLongToByteEncoder
 * @projectName boot2.X-netty
 * @description: 编码器
 * @date 2019/6/2 13:34
 */
public class MyLongToByteEncoder extends MessageToByteEncoder<Long>{
    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("encode invoked");
        System.out.println(msg);
        out.writeLong(msg);
    }
}
